/**
 * <copyright>
 * </copyright>
 *

 */
package scerbak.usecases.impl;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import scerbak.usecases.SubGoal;
import scerbak.usecases.UseCase;
import scerbak.usecases.UsecasesPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Sub Goal</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link scerbak.usecases.impl.SubGoalImpl#getIncludeUseCase <em>Include Use Case</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class SubGoalImpl extends ActionImpl implements SubGoal
{
  /**
   * The cached value of the '{@link #getIncludeUseCase() <em>Include Use Case</em>}' reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getIncludeUseCase()
   * @generated
   * @ordered
   */
  protected UseCase includeUseCase;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected SubGoalImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return UsecasesPackage.Literals.SUB_GOAL;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public UseCase getIncludeUseCase()
  {
    if (includeUseCase != null && includeUseCase.eIsProxy())
    {
      InternalEObject oldIncludeUseCase = (InternalEObject)includeUseCase;
      includeUseCase = (UseCase)eResolveProxy(oldIncludeUseCase);
      if (includeUseCase != oldIncludeUseCase)
      {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, UsecasesPackage.SUB_GOAL__INCLUDE_USE_CASE, oldIncludeUseCase, includeUseCase));
      }
    }
    return includeUseCase;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public UseCase basicGetIncludeUseCase()
  {
    return includeUseCase;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setIncludeUseCase(UseCase newIncludeUseCase)
  {
    UseCase oldIncludeUseCase = includeUseCase;
    includeUseCase = newIncludeUseCase;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, UsecasesPackage.SUB_GOAL__INCLUDE_USE_CASE, oldIncludeUseCase, includeUseCase));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case UsecasesPackage.SUB_GOAL__INCLUDE_USE_CASE:
        if (resolve) return getIncludeUseCase();
        return basicGetIncludeUseCase();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case UsecasesPackage.SUB_GOAL__INCLUDE_USE_CASE:
        setIncludeUseCase((UseCase)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case UsecasesPackage.SUB_GOAL__INCLUDE_USE_CASE:
        setIncludeUseCase((UseCase)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case UsecasesPackage.SUB_GOAL__INCLUDE_USE_CASE:
        return includeUseCase != null;
    }
    return super.eIsSet(featureID);
  }

} //SubGoalImpl
